package com.example.demo.netty.c3;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.NettyRuntime;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @description:
 * @author: hhl
 * @createDate: 2024/1/23
 * @version: 1.0
 */
@Slf4j
public class TestEventLoop {
    public static void main(String[] args) {
        //1.创建事件循环组
        EventLoopGroup group = new NioEventLoopGroup(2);
        //2.获取下个时间循环对象
//        group.next();
        //3,执行普通任务
//        group.next().submit(()->{
//            try {
//                Thread.sleep(1000);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//            log.debug("ok");
//        });
         group.next().scheduleAtFixedRate(()->{
             log.debug("ok");
         },0,1, TimeUnit.SECONDS);
            log.debug("main");
    }
}
